//
//  MyFileManager.swift
//  AlwayLocation
//
//  Created by macvivi on 2021/11/24.
//

import Foundation

class MyFileManager {
    
    static let shared = MyFileManager()
    
    let userDefault = UserDefaults.standard
    
    var userDefaultIndex: Int? {
        set {
            userDefault.setValue(newValue, forKey: "index")
            userDefault.synchronize()
        }
        get {
            if let index = userDefault.object(forKey: "index") {
                return index as? Int
            }
            return nil
        }
    }
   
    
    var launchOptionsKeyLocation: NSNumber? {
        set {
            userDefault.setValue(newValue, forKey: "launchOptionsKeyLocation")
            userDefault.synchronize()
        }
        get {
            if let index = userDefault.object(forKey: "launchOptionsKeyLocation") {
                return index as? NSNumber
            }
            return nil
        }
    }
    
}
